package com.parse.contract;

import java.util.HashMap;
import java.util.Map;

/**
 * 訊息
 * 
 * @author Andy
 * 
 */
public enum Msg {
	PASER_ERROR001("P0001,", "網路異常請稍後在試"), //

	DB_ERROR001("D0001", "資料處理失敗"), //

	BUSINESS_ERROR001("B0001", "作業失敗")//

	;
	final String code;
	final String content;

	final static Map<String, String> MAP;

	Msg(String code, String content) {
		this.code = code;
		this.content = content;
	}

	static {
		MAP = new HashMap<String, String>();

		for (Msg msg : Msg.values()) {
			MAP.put(msg.getCode(), msg.getContent());
		}

	}

	public static String content(String code) {
		return MAP.get(code);
	}

	public static String content(Msg msg) {

		return msg.getContent();

	}

	public String getCode() {
		return code;
	}

	public String getContent() {
		return content;
	}

}
